home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / CoreFoundation / CFBundle.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  6.4 KB  |  210 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        CFBundle.h
  3.  
  4.      Contains:    CoreFoundation bundle
  5.  
  6.      Version:    Technology:    Mac OS X
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __COREFOUNDATION_CFBUNDLE__
  18. #define __COREFOUNDATION_CFBUNDLE__
  19.  
  20. #ifndef __COREFOUNDATION_CFBASE__
  21.     #include <CoreFoundation\CFBase.h>
  22. #endif
  23.  
  24. #ifndef __COREFOUNDATION_CFARRAY__
  25.     #include <CoreFoundation\CFArray.h>
  26. #endif
  27.  
  28. #ifndef __COREFOUNDATION_CFSTRING__
  29.     #include <CoreFoundation\CFString.h>
  30. #endif
  31.  
  32. #ifndef __COREFOUNDATION_CFURL__
  33.     #include <CoreFoundation\CFURL.h>
  34. #endif
  35.  
  36. #ifndef __COREFOUNDATION_CFDICTIONARY__
  37.     #include <CoreFoundation\CFDictionary.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. typedef struct __CFBundle * CFBundleRef;
  64. typedef struct __CFBundle * CFPlugInRef;
  65. extern const CFStringRef kCFBundleInfoDictionaryVersionKey;
  66. extern const CFStringRef kCFBundleExecutableKey;
  67. extern const CFStringRef kCFBundleIdentifierKey;
  68. extern const CFStringRef kCFBundleVersionKey;
  69. extern const CFStringRef kCFBundleDevelopmentRegionKey;
  70. extern const CFStringRef kCFBundleNameKey;
  71. /* ===================== Finding Bundles ===================== */
  72. EXTERN_API_C( CFBundleRef )
  73. CFBundleGetMainBundle            (void);
  74.  
  75. EXTERN_API_C( CFBundleRef )
  76. CFBundleGetBundleWithIdentifier    (CFStringRef             bundleID);
  77.  
  78. /* A bundle can name itself by providing a key in the info dictionary. */
  79. /* This facility is meant to allow bundle-writers to get hold of their */
  80. /* bundle from their code without having to know where it was on the disk. */
  81. /* This is meant to be a replacement mechanism for +bundleForClass: users. */
  82. /* ===================== Creating Bundles ===================== */
  83. EXTERN_API_C( UInt32 )
  84. CFBundleGetTypeID                (void);
  85.  
  86. EXTERN_API_C( CFBundleRef )
  87. CFBundleCreate                    (CFAllocatorRef         allocator,
  88.                                  CFURLRef                 bundleURL);
  89.  
  90. /* Might return an existing instance with the ref-count bumped. */
  91. EXTERN_API_C( CFArrayRef )
  92. CFBundleCreateBundlesFromDirectory (CFAllocatorRef         allocator,
  93.                                  CFURLRef                 directoryURL,
  94.                                  CFStringRef             bundleType);
  95.  
  96. /* Create instances for all bundles in the given directory matching the given */
  97. /* type (or all of them if bundleType is NULL) */
  98. /* ==================== Basic Bundle Info ==================== */
  99. EXTERN_API_C( CFURLRef )
  100. CFBundleCopyBundleURL            (CFBundleRef             bundle);
  101.  
  102. EXTERN_API_C( CFDictionaryRef )
  103. CFBundleGetInfoDictionary        (CFBundleRef             bundle);
  104.  
  105. EXTERN_API_C( CFStringRef )
  106. CFBundleGetIdentifier            (CFBundleRef             bundle);
  107.  
  108. EXTERN_API_C( CFStringRef )
  109. CFBundleGetDevelopmentRegion    (CFBundleRef             bundle);
  110.  
  111. EXTERN_API_C( CFURLRef )
  112. CFBundleCopySupportFilesDirectoryURL (CFBundleRef         bundle);
  113.  
  114. EXTERN_API_C( CFURLRef )
  115. CFBundleCopyResourcesDirectoryURL (CFBundleRef             bundle);
  116.  
  117. /* ------------- Basic Bundle Info without a CFBundle instance ------------- */
  118. /* This API is provided to enable developers to use access a bundle Info */
  119. /* dictionary without having to create an instance of CFBundle. */
  120. EXTERN_API_C( CFDictionaryRef )
  121. CFBundleCopyInfoDictionaryInDirectory (CFURLRef         bundleURL);
  122.  
  123. /* ==================== Resource Handling API ==================== */
  124. EXTERN_API_C( CFURLRef )
  125. CFBundleCopyResourceURL            (CFBundleRef             bundle,
  126.                                  CFStringRef             resourceName,
  127.                                  CFStringRef             resourceType,
  128.                                  CFStringRef             subDirName);
  129.  
  130. EXTERN_API_C( CFArrayRef )
  131. CFBundleCopyResourceURLsOfType    (CFBundleRef             bundle,
  132.                                  CFStringRef             resourceType,
  133.                                  CFStringRef             subDirName);
  134.  
  135. EXTERN_API_C( CFStringRef )
  136. CFBundleCopyLocalizedString        (CFBundleRef             bundle,
  137.                                  CFStringRef             key,
  138.                                  CFStringRef             value,
  139.                                  CFStringRef             tableName);
  140.  
  141. #define CFCopyLocalizedString(key, comment) CFBundleCopyLocalizedString(CFBundleGetMainBundle(), (key), (key), NULL)
  142. #define CFCopyLocalizedStringFromTable(key, tbl, comment) CFBundleCopyLocalizedString(CFBundleGetMainBundle(), (key), (key), (tbl))
  143. #define CFCopyLocalizedStringFromTableInBundle(key, tbl, bundle, comment) CFBundleCopyLocalizedString((bundle), (key), (key), (tbl))
  144. /* ------------- Resource Handling without a CFBundle instance ------------- */
  145. /* This API is provided to enable developers to use the CFBundle resource */
  146. /* searching policy without having to create an instance of CFBundle. */
  147. /* Because of caching behavior when a CFBundle instance exists, it will be faster */
  148. /* to actually create a CFBundle if you need to access several resources. */
  149. EXTERN_API_C( CFURLRef )
  150. CFBundleCopyResourceURLInDirectory (CFURLRef             bundleURL,
  151.                                  CFStringRef             resourceName,
  152.                                  CFStringRef             resourceType,
  153.                                  CFStringRef             subDirName);
  154.  
  155. EXTERN_API_C( CFArrayRef )
  156. CFBundleCopyResourceURLsOfTypeInDirectory (CFURLRef     bundleURL,
  157.                                  CFStringRef             resourceType,
  158.                                  CFStringRef             subDirName);
  159.  
  160. /* ==================== Primitive Code Loading API ==================== */
  161. /* This API abstracts the variosu different executable formats supported on various platforms. */
  162. /* It can load DYLD, CFM, or DLL shared libraries (on their appropriate platforms) and gives a */
  163. /* uniform API for looking up functions. */
  164. EXTERN_API_C( CFURLRef )
  165. CFBundleCopyExecutableURL        (CFBundleRef             bundle);
  166.  
  167. EXTERN_API_C( Boolean )
  168. CFBundleIsExecutableLoaded        (CFBundleRef             bundle);
  169.  
  170. EXTERN_API_C( Boolean )
  171. CFBundleLoadExecutable            (CFBundleRef             bundle);
  172.  
  173. EXTERN_API_C( void )
  174. CFBundleUnloadExecutable        (CFBundleRef             bundle);
  175.  
  176. EXTERN_API_C( void *)
  177. CFBundleGetFunctionPointerForName (CFBundleRef             bundle,
  178.                                  CFStringRef             functionName);
  179.  
  180. EXTERN_API_C( void )
  181. CFBundleGetFunctionPointersForNames (CFBundleRef         bundle,
  182.                                  CFArrayRef             functionNames,
  183.                                  void *                    ftbl[]);
  184.  
  185. /* ==================== Getting a bundles plugIn ==================== */
  186. EXTERN_API_C( CFPlugInRef )
  187. CFBundleGetPlugIn                (CFBundleRef             bundle);
  188.  
  189.  
  190. #if PRAGMA_STRUCT_ALIGN
  191.     #pragma options align=reset
  192. #elif PRAGMA_STRUCT_PACKPUSH
  193.     #pragma pack(pop)
  194. #elif PRAGMA_STRUCT_PACK
  195.     #pragma pack()
  196. #endif
  197.  
  198. #ifdef PRAGMA_IMPORT_OFF
  199. #pragma import off
  200. #elif PRAGMA_IMPORT
  201. #pragma import reset
  202. #endif
  203.  
  204. #ifdef __cplusplus
  205. }
  206. #endif
  207.  
  208. #endif /* __COREFOUNDATION_CFBUNDLE__ */
  209.  
  210.